export default class Http {
  static request(url, method = 'GET', data = {}) {
    return new Promise((resolve, reject) => {
      wx.showLoading({
        title: '加载中',
        mask: true
      })
      wx.request({
        url,
        method,
        data,
        success: (res) => {
          wx.hideLoading()
          resolve(res)
        },
        fail: (err) => {
          wx.showToast({
            title: '请刷新重试',
            icon: 'none',
            mask: true
          })
          reject(err)
        }
      })
    })
  }
}